package com.bdsy.system.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.system.dao.RoleMapper;
import com.bdsy.system.model.Role;
import com.bdsy.system.service.RoleService;

/**
 * ClassName:UserServiceImpl
 * Description: TODO 添加描述.
 * @author   Administrator
 * @version  
 * @since    JDK 1.8
 */

@Service("roleService")
public class RoleServiceImpl implements RoleService{

    @Autowired
    RoleMapper roleMapper;
    
	@Override
	public List<Role> getRole() {
		List<Role> role = roleMapper.selectRole();
		return role;
	}
	
	@Override
	public List<Role> getRoleById(String id) {
		List<Role> role = roleMapper.selectRoleById(id);
		return role;
	}
	
	@Override
	public boolean addRole(Role role){
		int result = roleMapper.insert(role);
		return result>0?true:false;
	}
	
	@Override
	public boolean updateRole(Role role){
		int result = roleMapper.update(role);
		return result>0?true:false;
	}

	@Override
	public Role checkRoleName(Role role) {
		return roleMapper.checkRoleName(role);
	}

	@Override
	public Role checkUpdateRoleName(Role role) {
		return roleMapper.checkUpdateRoleName(role);
	}
    
}

